/**
* @description: 932. 漂亮数组
* @author hewei
* @date 2022/9/21 16:38
* @version 1.0
*/

public class BeautifulArray {

    public int[] beautifulArray(int n) {
        int[] ans = new int[n];
        if (n == 1) {
            ans[0] = 1;
            return ans;
        }
        int[] temp1 = beautifulArray((n + 1) / 2);
        int[] temp2 = beautifulArray(n / 2);
        for (int i = 0; i < temp1.length; i++) {
            ans[i] = temp1[i] * 2 - 1;
        }
        for (int i = 0; i < temp2.length; i++) {
            ans[temp1.length + i] = temp2[i] * 2;
        }
        return ans;
    }
}